#include "iostream"

#define maxsize 1000
using namespace std;

void run() {
    string input;
    getline(cin, input);

    int count = 0;
    int number[maxsize];

    string tmp = "";
    for (int i = 0; i < input.size(); ++i) {
        if (input[i] == ' ') {
            if (tmp != "") {
                number[count] = stoi(tmp);
                count++;
                tmp = "";
            }
        } else {
            tmp += input[i];
        }
    }

    if (tmp != "") {
        number[count] = stoi(tmp);
        count++;
        tmp = "";
    }

    if (number[1] == 0) {
        cout << "0 0";
    } else {
        if (number[count - 1] == 0) {
            count -= 2;
        }

        string str = "";
        for (int i = 0; i < count; ++i) {
            if (i % 2) {
                number[i] -= 1;
                str = str + to_string(number[i]) + " ";
            } else {
                number[i] *= number[i + 1];
                str = str + to_string(number[i]) + " ";
            }
        }
        cout << str.substr(0, str.size() - 1);
    }
}

int main() {
    run();
    return 0;
}
